Manages the viewports available in the component. More...
Public Member Functions | |
~ViewportManager () | |
Viewport * | getActiveViewport () const |
void | setActiveViewport (Viewport *value) |
Viewport * | createOrRetrieve (const std::string_view &name) |
Viewport * | get (const std::string_view &name) |
Viewport * | getByIndex (unsigned int index) |
void | rename (const std::string_view ¤tName, const std::string_view &newName) |
void | erase (const std::string_view &name) |
Manages the viewports available in the component.
At all times, the manager owns the memory it allocates. External code should never delete it.
nkGraphics::ViewportManager::~ViewportManager | ( | ) |
Destructor.
Viewport* nkGraphics::ViewportManager::getActiveViewport | ( | ) | const |
void nkGraphics::ViewportManager::setActiveViewport | ( | Viewport * | value | ) |
Sets currently active viewport for the pass. This is used during rendering to keep track of what is active and feed shaders with the right information.
value | The viewport active. |
Viewport* nkGraphics::ViewportManager::createOrRetrieve | ( | const std::string_view & | name | ) |
Creates if unavailable, or retrieve if available, viewport attached with given name.
name | The name of the viewport to retrieve. |
Viewport* nkGraphics::ViewportManager::get | ( | const std::string_view & | name | ) |
Retrives an existing viewport.
name | The name of the viewport to retrieve. |
Viewport* nkGraphics::ViewportManager::getByIndex | ( | unsigned int | index | ) |
Accesses a viewport, by index in the manager memory. Note that an index can point to different viewport after manipulating the manager memory (add or remove viewports). This function mainly serves to go over all existing viewports in one go.
index | The index of the viewport to retrieve. |
void nkGraphics::ViewportManager::rename | ( | const std::string_view & | currentName, |
const std::string_view & | newName | ||
) |
Renames a viewport from one name to another.
currentName | The name of the viewport to rename. |
newName | The new name to assign to the viewport/ |
void nkGraphics::ViewportManager::erase | ( | const std::string_view & | name | ) |
Erases a viewport and frees its memory.
name | The name of the viewport to erase. |